<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/Applications/function.php';
$time = get_microtime();
echo "初始: ".memory_get_usage()."B\n";

/**
 * 循环10000次 750毫秒
 * 循环100000次 4150 毫秒
 */
for ($i = 0; $i < 1; $i++) {
    $data = [
        'messageData' => [
            'ping' => []
        ],
        'timestamp' => get_microtime(),
        'reqUnique' => uniqid()
    ];
    $string = json_encode($data);
    echo strlen($string). " \n";
    $data2 = json_decode($string);
    echo "使用: ".memory_get_usage()."B\n";
}
echo "释放: ".memory_get_usage()."B\n";
echo "峰值: ".memory_get_peak_usage()."B\n";
echo get_microtime() - $time . " \n";
